﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using FlexiCommerce.Web;

namespace FlexiCommerce.Tests.Fakes
{
    public class FakeWebContextWrapper : ThreadContext
    {
        public FakeWebContextWrapper()
        {
        }
        public FakeWebContextWrapper(string currentUrl)
        {
            Url = currentUrl;
        }
        public IPrincipal currentUser = SecurityUtilities.CreatePrincipal("admin");

        public override IPrincipal User
        {
            get { return currentUser; }
        }
        public override string ToAbsolute(string virtualPath)
        {
            return virtualPath.TrimStart('~');
        }
        public override string ToAppRelative(string virtualPath)
        {
            return virtualPath;
        }

        public string rewrittenPath;
        public override void RewritePath(string path)
        {
            rewrittenPath = path;
        }
    }
}
